﻿var vm = new Vue({
    el: '#app'
    , data: {
        old_pwd: ''
        , new_pwd: ''
        , repeat_pwd: ''
    }
    , methods: {
        onUpdatePassword: async function () {
            let me = this;
            if (!me.old_pwd) {
                hcCore.showError('请输入原密码');
                return;
            }
            if (!me.new_pwd) {
                hcCore.showError('请输入新密码');
                return;
            }
            if (me.old_pwd == me.new_pwd) {
                hcCore.showError('原密码不能和新密码一致');
                return;
            }
            if (!me.repeat_pwd) {
                hcCore.showError('请输入重复密码');
                return;
            }
            if (me.new_pwd != me.repeat_pwd) {
                hcCore.showError('新密码和重复密码不一致');
                return;
            }
            await hcCore.post({
                url: '/Personal/UpdatePassword'
                , param: {
                    old_pwd: md5(me.old_pwd)
                    , new_pwd: md5(me.new_pwd)
                }
                , success: '修改成功'
                , error: '修改失败'
            });
        }
    }
});